package interfaces.superWidgets;

import fileHandling.language.Lang;
import interfaces.hud.BasicHUD;

public abstract class MinSizeWindow extends MinimizeWindow {
	
	protected Lang title;
	protected int maxSize;
	protected int width, height, y;
	
	public MinSizeWindow(Lang title, Mode mode, BasicHUD hud, int width, int height, int y) {
		super(title, mode, hud);
		this.title = title;
		this.width = width;
		this.height = height;
		this.y = y;
		
		setWidth(width);
		setHeight(height);
		setY(y);
		
		maxSize = minimizeButton.getWidth();
	}
	
	public abstract String getMinimizedTitle();
	
	public abstract String getMaximizedTitle();
	
	@Override
	public void setMinimized(boolean minimize) {
		super.setMinimized(minimize);
		
		if(minimize) {
			String minText = getMinimizedTitle();
			minimizeButton.setText(minText);
			int width = minimizeButtonFont.getWidth(minText) + minimizeButtonFont.getWidth("ww");
			minimizeButton.setWidth(width);
			setWidth(width);
			setY(y + height - getHeight());
		} else {
			minimizeButton.setText(getMaximizedTitle());
			minimizeButton.setWidth(maxSize);
			setWidth(width);
			setY(y);
		}
		
		layout();
	}
}